load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "cmds",
    srcs = [
        "binfmt.go",
        "cmds.go",
        "grpc.go",
        "grpc_reflect.go",
        "proto_decode.go",
    ],
    importpath = "github.com/pachyderm/pachyderm/v2/src/server/misc/cmds",
    visibility = ["//visibility:public"],
    deps = [
        "//src/admin",
        "//src/auth",
        "//src/debug",
        "//src/enterprise",
        "//src/identity",
        "//src/internal/archiveserver",
        "//src/internal/cmdutil",
        "//src/internal/dbutil",
        "//src/internal/errors",
        "//src/internal/grpcutil",
        "//src/internal/log",
        "//src/internal/middleware/logging/client",
        "//src/internal/pachctl",
        "//src/internal/preflight",
        "//src/internal/promutil",
        "//src/internal/signals",
        "//src/license",
        "//src/logs",
        "//src/metadata",
        "//src/pfs",
        "//src/pjs",
        "//src/pps",
        "//src/proxy",
        "//src/snapshot",
        "//src/storage",
        "//src/transaction",
        "//src/version/versionpb",
        "//src/worker",
        "@com_github_jmoiron_sqlx//:sqlx",
        "@com_github_spf13_cobra//:cobra",
        "@org_golang_google_grpc//:grpc",
        "@org_golang_google_grpc//credentials",
        "@org_golang_google_grpc//credentials/insecure",
        "@org_golang_google_grpc//keepalive",
        "@org_golang_google_grpc//metadata",
        "@org_golang_google_grpc//status",
        "@org_golang_google_protobuf//encoding/protojson",
        "@org_golang_google_protobuf//proto",
        "@org_golang_google_protobuf//reflect/protoreflect",
        "@org_golang_google_protobuf//reflect/protoregistry",
        "@org_golang_google_protobuf//types/dynamicpb",
        "@org_golang_x_exp//maps",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "cmds_test",
    size = "small",
    srcs = [
        "binfmt_test.go",
        "grpc_test.go",
        "proto_decode_test.go",
    ],
    embed = [":cmds"],
    deps = [
        "//src/admin",
        "//src/internal/pctx",
        "//src/pfs",
        "@com_github_google_go_cmp//cmp",
        "@org_golang_google_grpc//:grpc",
        "@org_golang_google_grpc//codes",
        "@org_golang_google_grpc//status",
        "@org_golang_google_protobuf//encoding/protojson",
        "@org_golang_google_protobuf//proto",
        "@org_golang_google_protobuf//testing/protocmp",
        "@org_golang_google_protobuf//types/known/emptypb",
    ],
)
